Advertisement
FlyFar

comms_test.go

Dec 17th, 2023
1,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.57 KB | Cybersecurity | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "testing"
  6. )
  7.  
  8. func TestComms(t *testing.T) {
  9.     fmt.Println("Generating key...")
  10.  
  11.     priv := Generate()
  12.     str := Stringify(priv)
  13.     fmt.Println(str)
  14.  
  15.     fmt.Println("Uploading...")
  16.     err := PostKey(priv)
  17.  
  18.     if err != nil {
  19.         panic(err)
  20.     }
  21.  
  22.     fmt.Println("Key uploaded")
  23.  
  24.     fmt.Println("Retrieving key...")
  25.     priv, err = GetKey()
  26.  
  27.     if err != nil {
  28.         panic(err)
  29.     }
  30.  
  31.     fmt.Println(Stringify(priv))
  32. }
  33.  
  34. func TestServer(t *testing.T) {
  35.     fmt.Println("Sending the same key twice...")
  36.     priv := Generate()
  37.     PostKey(priv)
  38.     PostKey(priv)
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement