test_forms.py imports the TestRelation model from the models.py to use in the test (I do this because I needed to make a mock model to use in this case)
Siecje
epicowl: why do you have models used for testing only?
atula
epicowl: oh that is odd. I have never needed to have models in tests
epicowl
Siecje: because the model used in the project is in another project that is layered on top of the project Im working in
atula
ah I see.
epicowl
and the base model in the project I'm working in is an abstract model
unfortunately, my HTML is still coming out wrecked, so this'll be fun to try and figure out :D
ryannielson has quit
preds joined the channel
sohail joined the channel
dray3 joined the channel
tbaxter
kezabelle: I'm seeing closing LIs, but no opening?
kezabelle
yeah, that is happening outside the scope of that snippet
the tag seems to work correctly, assuming I can jiggle the HTML into the correct order ;)
Kobrakao has quit
quake_guy has quit
all this just to avoid recursion :|
tbaxter
That's what I'm saying… you're closing LIs, but not opening them. Browser is probably guessing that you want to open, but missing one.
Sharebear has quit
batisteo has quit
Course I haven't seen the output, so that's WAG
kezabelle
oh yeah, I'm well aware that it won't work with the output you see there, but the template it's in needs refactoring, and would only have muddied the situation :)
bwillielv has quit
mrap has quit
asparagui joined the channel
margle joined the channel
margle has quit
margle joined the channel
m8 has quit
Raisins joined the channel
rabbite joined the channel
tsurantino
hey guys so I subclassed AbstractUser to add 2 fields - but now when I sync Django doesn't ask me to make an admin user or anything
do I have to redefine these methods? I thought AbstractUser would handle it
tsurantino: it won't prompt you for creation if you don't use the default model, just call create(super)user yourself
rabbite
I'm really new to django, coming from ruby on rails. I've inherited a fairly large project, and I'm trying to write test for it. I have request = self.factory.get('/rbd/schedule/')
Then self.assertEqual(request.status_code, 200)
which keeps failing because the response is returning a 302
andrey_ has quit
is it normal in django for every url to be a redirect?
kezabelle
of course not
tsurantino
jwa: can you be more specific?
rabbite
It doesnt appear that way in the server logs when I do it manually in local.
kezabelle
does it require authentication or something?
jwa
tsurantino: I suppose you have changed AUTH_USER_MODEL? if so just call manage.py createsuperuser
rabbite
kezabelle: normally, everything exists behind a login
ahh unrelated
kezabelle
rabbite: so why are you surprised you get redirected to the login? :)
rabbite
I've found that response = self.client.get('/rbd/settings/', follow=True)
returns 200 though.
zenethian
ls
bah
kezabelle
wrong window ;)
rabbite
Think it might be because it's bouncing me to the login?
zenethian
Indeed, hah.
kezabelle
rabbite: unless your test client is logged in, yes
margle has quit
melinath has quit
(and the login is a 200, which is why following the redirect will get the 'correct' status_code, even though it's wrong)
rabbite
Any resources where I can read up about writing test for systems behind a login?
I see, I suspected as much, but wasn't sure if it was a Django thing.
__love__
rabbite: just log the test client in. self.client.login(username, password), iirc
tbaxter
as I recall, factory doesn't authenticate (or have request, by default), which makes TestClient considerably easier to use.
melinath joined the channel
sudobangbang has quit
sohail has quit
tsurantino
jwa: so I have a foreign key that (apparently) can't be null. is there any way I can modify createsuperuser to give it some arbitrary value?
Sharebear joined the channel
nicklo joined the channel
jwa
tsurantino: createsuperuser doesn't support fkeys, no
tsurantino
ok cool, thanks
rabbite
__love__: Would I need to do that in every test? Or can I handle that in the setup?
jwa
rabbite: setUp() is for that, yes
Kingino joined the channel
Kingino has quit
Kingino joined the channel
rabbite
Hm, thanks. I'll give those suggestions a try. Yet another reason I <3 freenode
epicowl
atula: got it working… had to import the model in my __init__ file
jwa
rabbite: well not every channel's as friendly as #django ;)