def setup_class(cls): owner = User(username='******', email='*****@*****.**', location={'lat':0, 'lon':0}, crypted_password='******', creation_date = datetime.now()) owner.save() organization = Organization(owner = owner, organization_name = 'My organization Channel', creation_date = datetime.now()) organization.save() cls.channel = Channel(channel_name = 'MyChannel', private = False, owner = 'Creator', creation_date = datetime.now()) cls.channel.save() organization.update(push__channels = cls.channel)
def test_is_valid_token(self): user = User(username='******', email='*****@*****.**', crypted_password='******') token = self.organization.invite_user(user) self.organization.pending_invitations[token] = user assert self.organization.is_valid_token(token)
def test_add_new_member(self): member = User(username='******', email='*****@*****.**', crypted_password='******') self.organization.members.append(member) assert len(self.organization.members) == 1 assert self.organization.is_member(member) is True
def setup_class(cls): cls.user1 = User(username='******', email='*****@*****.**', crypted_password='******', creation_date=datetime.now()) cls.user2 = User(username='******', email='*****@*****.**', crypted_password='******', creation_date=datetime.now()) cls.user3 = User(username='******', email='*****@*****.**', crypted_password='******', creation_date=datetime.now()) cls.user1.save() cls.user2.save() cls.user3.save() cls.organization = Organization( owner=cls.user1, organization_name='My Organization Direct', creation_date=datetime.now()) cls.organization.save()
def test_new_user(self): user = User(username='******', email='*****@*****.**', crypted_password='******') assert user.username == 'MiNombre' assert user.email == '*****@*****.**' assert user.crypted_password == 'mipass'
def setup_method(self, method): self.owner = User(username='******', email='*****@*****.**', crypted_password='******') self.organization = Organization(owner=self.owner, organization_name='My organization')
def test_generate_invite_token(self): user = User(username='******', email='*****@*****.**', crypted_password='******') token = self.organization.invite_user(user) assert token != ''