
from django.test import TestCase


class SimpleTest(TestCase):
    def test_basic_addition(self):
        """
        Tests that 1 + 1 always equals 2.
        """
        self.assertEqual(1 + 1, 2)

from datetime import time
from django.test import client, TestCase
from members.models import User
from .models import Report
from protocols.models import Topic


client = client.Client()


class ReportTest(TestCase):
    def setUp(self):
        self.kril = User.objects.create(
            username='Kril',
            faculty_number='61277',
            email='kril@gmail.com',)
        self.kril.set_password('kril')
        self.kril.save()

        self.topic1 = Topic.objects.create(
            name='1',
            description='first',
            voted_for=13,
            voted_against=4,
            voted_abstain=5)
        self.topic2 = Topic.objects.create(
            name='2',
            description='second',
            voted_for=13,
            voted_against=4,
            voted_abstain=5)
        self.topic3 = Topic.objects.create(
            name='3',
            description='third',
            voted_for=13,
            voted_against=4,
            voted_abstain=5)


    def test_add_report(self):
        client.login(username='Kril', password='kril')
        response = client.post('/reports/add/', {
                        "addressed_to": "Hackfmi",
                        "reported_from": self.kril.pk,
                        "content": "This is a report test",
                        "copies": [self.topic1.pk, self.topic2.pk, self.topic3.pk],})

        import ipdb; ipdb.set_trace()
        self.assertEqual(200, response.status_code)
        self.assertEqual(1, len(Report.objects.all()))

Add test for adding report
Add test for adding report

- 
+ from datetime import time
- from django.test import TestCase
+ from django.test import client, TestCase
+ from members.models import User
+ from .models import Report
+ from protocols.models import Topic
  
  
+ client = client.Client()
- class SimpleTest(TestCase):
-     def test_basic_addition(self):
-         """
-         Tests that 1 + 1 always equals 2.
-         """
-         self.assertEqual(1 + 1, 2)
  
+ 
+ class ReportTest(TestCase):
+     def setUp(self):
+         self.kril = User.objects.create(
+             username='Kril',
+             faculty_number='61277',
+             email='kril@gmail.com',)
+         self.kril.set_password('kril')
+         self.kril.save()
+ 
+         self.topic1 = Topic.objects.create(
+             name='1',
+             description='first',
+             voted_for=13,
+             voted_against=4,
+             voted_abstain=5)
+         self.topic2 = Topic.objects.create(
+             name='2',
+             description='second',
+             voted_for=13,
+             voted_against=4,
+             voted_abstain=5)
+         self.topic3 = Topic.objects.create(
+             name='3',
+             description='third',
+             voted_for=13,
+             voted_against=4,
+             voted_abstain=5)
+ 
+ 
+     def test_add_report(self):
+         client.login(username='Kril', password='kril')
+         response = client.post('/reports/add/', {
+                         "addressed_to": "Hackfmi",
+                         "reported_from": self.kril.pk,
+                         "content": "This is a report test",
+                         "copies": [self.topic1.pk, self.topic2.pk, self.topic3.pk],})
+ 
+         import ipdb; ipdb.set_trace()
+         self.assertEqual(200, response.status_code)
+         self.assertEqual(1, len(Report.objects.all()))
+ 
Add test for adding report
## Code Before:

from django.test import TestCase


class SimpleTest(TestCase):
    def test_basic_addition(self):
        """
        Tests that 1 + 1 always equals 2.
        """
        self.assertEqual(1 + 1, 2)

## Instruction:
Add test for adding report
## Code After:
from datetime import time
from django.test import client, TestCase
from members.models import User
from .models import Report
from protocols.models import Topic


client = client.Client()


class ReportTest(TestCase):
    def setUp(self):
        self.kril = User.objects.create(
            username='Kril',
            faculty_number='61277',
            email='kril@gmail.com',)
        self.kril.set_password('kril')
        self.kril.save()

        self.topic1 = Topic.objects.create(
            name='1',
            description='first',
            voted_for=13,
            voted_against=4,
            voted_abstain=5)
        self.topic2 = Topic.objects.create(
            name='2',
            description='second',
            voted_for=13,
            voted_against=4,
            voted_abstain=5)
        self.topic3 = Topic.objects.create(
            name='3',
            description='third',
            voted_for=13,
            voted_against=4,
            voted_abstain=5)


    def test_add_report(self):
        client.login(username='Kril', password='kril')
        response = client.post('/reports/add/', {
                        "addressed_to": "Hackfmi",
                        "reported_from": self.kril.pk,
                        "content": "This is a report test",
                        "copies": [self.topic1.pk, self.topic2.pk, self.topic3.pk],})

        import ipdb; ipdb.set_trace()
        self.assertEqual(200, response.status_code)
        self.assertEqual(1, len(Report.objects.all()))
