def test_correct_user_passed(self): user = User.get(self.username) self.assert_user_data_passed( user=user, login=self.username, name=self.user_dict['gecos'], )
def test_macs_passed(self): for mac in self.fixtures_pg.get(Mac, []): if mac.account is None: continue with self.subTest(mac=mac.mac): user = User.get(mac.account) self.assertIn(mac.mac.lower(), user.mac)
def test_ips_passed(self): for account in self.fixtures[Account]: with self.subTest(account=account): user = User.get(account.account) expected_ips = self.session.query(Account).get(account.account).ips for ip in expected_ips: with self.subTest(ip=ip): self.assertIn(ip.ip, user.ips)
def test_passive_user_status_correct(self): for account in self.accounts: if account.properties.active: continue with self.subTest(account=account): user = User.get(account.account) self.assertEqual(user.status, gettext("Passiv"))
def test_ips_passed(self): for account in self.fixtures_pg[Account]: with self.subTest(account=account): user = User.get(account.account) expected_ips = self.session.query(Account).get(account.account).ips for ip in expected_ips: with self.subTest(ip=ip): self.assertIn(ip.ip, user.ips)
def test_user_is_connected_or_not(self): for account in self.accounts: with self.subTest(account=account): user = User.get(account.account) self.assertTrue(user.has_connection)
def setUp(self): super().setUp() self.user = User.get(self.account.account) self.history = self.user.traffic_history
def test_from_ip_correct_user(self): for ip in self.fixtures_pg[IP]: if not ip.account: continue with self.subTest(ip=ip.ip): self.assertEqual(User.get(ip.account), User.from_ip(ip.ip))
def test_user_is_active_or_not(self): for account in self.accounts: with self.subTest(account=account): user = User.get(account.account) self.assertEqual(user.has_connection, account.properties.active)
def test_user_get_uses_database(self): # A warning about a RuntimeError is thrown due to the # missing app context with disable_logs(logging.WARNING): self.assertIsInstance(User.get('test'), AnonymousUserMixin)
def test_mail_correct(self): acc = self.fixtures_pg[Account][0] user = User.get(acc.account) expected_mail = "{}@wh12.tu-dresden.de".format(acc.account) self.assertEqual(user.mail, expected_mail)