Ejemplo n.º 1
0
 def test_create_company_valid_two_owners(self):
     login_user(self)
     first_user = self.user
     login_user(context=self, username='******')
     second_user = self.user
     company = Company.create_owned_company(name="Testbahn", abbrev="TB", owners=[first_user, second_user])
     self.assertEquals(first_user.company_set.all().count(), 1)
     self.assertEquals(second_user.company_set.all().count(), 1)
     self.assertEquals(company.ownership.all().count(), 2)
Ejemplo n.º 2
0
 def test_create_valid_full(self):
     Route.objects.create(operator=Company.create_owned_company(
         name="Testbahn", abbrev="TB", owners=login_user(self)),
                          name=self.DEMO_ROUTE_NAME,
                          type=Route.LONG_DISTANCE,
                          revenue_per_week=5000.00,
                          start_date=now(),
                          end_date=now() + timedelta(days=2 * 365))
Ejemplo n.º 3
0
 def test_to_string_full(self):
     route = Route(operator=Company.create_owned_company(
         name="Testbahn", abbrev="TB", owners=login_user(self)),
                   name=self.DEMO_ROUTE_NAME,
                   type=Route.LONG_DISTANCE,
                   revenue_per_week=5000.00,
                   start_date=now(),
                   end_date=now() + timedelta(days=2 * 365))
     self.assertEquals(route.__str__(),
                       'KBS 100 Hamburg - Rostock (Testbahn)')
Ejemplo n.º 4
0
    def test_check_default_no_companies(self):
        login_user(self)

        self.assertEquals(self.user.company_set.all().count(), 0)
        self.assertEquals(Company.objects.all().count(), 0)
Ejemplo n.º 5
0
 def test_create_company_to_string(self):
     login_user(self)
     company = Company.create_owned_company(name="TestBahn", abbrev="TB", owners=self.user)
     self.assertEquals(company.__str__(), "TestBahn (TB)")
Ejemplo n.º 6
0
    def test_create_company_duplicate_abbrev(self):
        login_user(self)
        Company.create_owned_company(name="Testbahn", abbrev="TB", owners=self.user)

        with self.assertRaises(IntegrityError, msg="Adding a company with existing abbreviation, should not work"):
            Company.create_owned_company(name="Tolle Bahn", abbrev="TB", owners=self.user)
Ejemplo n.º 7
0
 def test_create_company_valid_one_owner(self):
     login_user(self)
     Company.create_owned_company(name="Testbahn", abbrev="TB", owners=self.user)
     self.assertEquals(self.user.company_set.all().count(), 1)