Пример #1
0
 def test_agent_account_create(self):
     account = {"homePage":"http://www.adlnet.gov","name":"freakshow"}
     bob = Agent()
     bob.save()
     bobacc = AgentAccount(agent=bob, **account)
     bobacc.save()
     a = bob.agentaccount
     self.assertEquals(a.name, "freakshow")
     self.assertEquals(a.homePage, "http://www.adlnet.gov")
     self.assertEquals(a.agent, bob)
     self.assertFalse(bob.name)
     self.assertFalse(bob.mbox)
     self.assertFalse(bob.mbox_sha1sum)
     self.assertFalse(bob.openID)
Пример #2
0
    def test_agent_del(self):
        ag = Agent(name="the agent")
        ag.save()
        acc = AgentAccount(agent=ag, homePage="http://adlnet.gov/agent/1", name="agent 1 account")
        acc.save()

        self.assertEquals(ag.name, "the agent")
        self.assertEquals(ag.agentaccount.name, "agent 1 account")
        self.assertEquals(ag.agentaccount.homePage, "http://adlnet.gov/agent/1")
        self.assertEquals(1, len(Agent.objects.all()))
        self.assertEquals(1, len(AgentAccount.objects.all()))

        ag.delete()

        self.assertEquals(0, len(Agent.objects.all()))
        self.assertEquals(0, len(AgentAccount.objects.all()))