Exemplo n.º 1
0
    def test_equality(self):
        a = Promotion(self.promo_id, self.title, self.subtitle, self.heading,
                      self.url, self.url_scheme, self.text_color,
                      self.gradient, self.image)
        b = Promotion('', self.title, self.subtitle, '', self.url,
                      self.url_scheme, self.text_color, self.gradient,
                      self.image)
        c = Promotion(self.promo_id, '', self.subtitle, self.heading, self.url,
                      self.url_scheme, self.text_color, self.gradient, '')
        d = Promotion(self.promo_id, self.title, self.subtitle, self.heading,
                      self.url, self.url_scheme, self.text_color,
                      self.gradient, self.image)

        assert a != b != c
        assert hash(a) != hash(b) != hash(c)
        assert a is not b is not c

        assert a == d
Exemplo n.º 2
0
def promotion():
    return Promotion(
        TestPromotion.promo_id,
        TestPromotion.title,
        TestPromotion.subtitle,
        TestPromotion.heading,
        TestPromotion.url,
        TestPromotion.url_scheme,
        TestPromotion.text_color,
        TestPromotion.gradient,
        TestPromotion.image,
    )
Exemplo n.º 3
0
    def test_de_json_all(self, client):
        json_dict = {
            'promo_id': self.promo_id,
            'title': self.title,
            'subtitle': self.subtitle,
            'heading': self.heading,
            'url': self.url,
            'url_scheme': self.url_scheme,
            'text_color': self.text_color,
            'gradient': self.gradient,
            'image': self.image
        }
        promotion = Promotion.de_json(json_dict, client)

        assert promotion.promo_id == self.promo_id
        assert promotion.title == self.title
        assert promotion.subtitle == self.subtitle
        assert promotion.heading == self.heading
        assert promotion.url == self.url
        assert promotion.url_scheme == self.url_scheme
        assert promotion.text_color == self.text_color
        assert promotion.gradient == self.gradient
        assert promotion.image == self.image
Exemplo n.º 4
0
 def test_de_json_none(self, client):
     assert Promotion.de_json({}, client) is None
Exemplo n.º 5
0
 def test_de_list_none(self, client):
     assert Promotion.de_list({}, client) == []